 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 添加商户</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="{$Think.config.site.common_resource_url}js/chosen/chosen.css" rel="stylesheet" type="text/css"/>
</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}
.specval-hide{display: none;}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
    	<form method="post" class="form-horizontal">
        <div class="row">
            <!-- 商品信息 -->
          	<div class="col-sm-12">
                <div class="float-e-margins">
                    <div class="ibox-content">
                        <div class="row">
                            <div class="form-group">
                                <label class="col-sm-2 control-label text-right">商户名称：</label>
                                <div class="col-sm-6">
                                    <input name="shop_name" class="form-control" type="text" value="" placeholder="选填">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label text-right">商户手机：</label>
                                <div class="col-sm-6">
                                    <input id="phone" name="phone" class="form-control" type="text" value="" placeholder="必须是商户的手机号码，不能是座机">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label text-right">绑定管家：</label>
                                <div class="col-sm-6">
                                    <select name="agent_id" class="chosen-select form-control chs">
                                        <option value="0">请选择</option>
                                        {volist name="list" id="vo"}
                                        <option value="{$vo.id}">{$vo.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 保存 -->
            <div class="col-sm-12">
                <div class="float-e-margins">
                    <div class="ibox-content">
                        <div class="row">
                            <div class="form-group">
                                <div class="col-sm-5 col-sm-offset-2">
     
                                    <input type="submit" class="btn btn-primary" value="提交">
                           
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 保存 -->
        </div>
    	</form>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>
    <script type="text/javascript" src="{$Think.config.site.common_resource_url}js/chosen/chosen.jquery.js"></script>

    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
</body>

</html>
<script>

var layer_font='';
$(function() {
	$(".chs").chosen({no_results_text: "没有找到："});

	$("form").validate({
	  debug:false,
	  submitHandler:function(form){
            save();   
      },    
	  rules: {
		phone: {
            required: true,
		},
		
	  },
	  messages: {
		phone: {
			required: '商户手机号码必须填写，且必须是商户的手机号码',
		},
	  }
	});
})

function save(){
	var fomrData = $("form").serialize();

	majax('{:url("addshop")}',fomrData,function(d){
		if (d.code>0) {
			window.parent.editsuccess();
		}else{
			layer.msg(d.msg, {icon: 2});
		}
	})
};
</script>